<?php
/**
 * Copyright (C), 2021-2021, Shall Buy Life info. Co., Ltd.
 * FileName: CategoryService.php
 * Description: 说明
 *
 * @author lwl
 * @Create Date    2021/10/10 16:30
 * @Update Date    2021/10/10 16:30 By lwl
 * @version v1.0
 */
namespace App\Services;

use App\Constants\ErrorResponse;
use App\Models\Category;

class CategoryService
{
    protected $model;
    public function __construct(Category $model)
    {
        $this->model = $model;
    }
    /**
     * FunctionName：getAll
     * Description：全部
     * Author：lwl
     * @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection
     */
    public function getAll()
    {
       return $this->model::getAll();
    }

    /**
     * FunctionName：store
     * Description：
     * Author：lwl
     * @param array $params
     * @return mixed
     */
    public function store(array $params)
    {
        return $this->model::store($params);
    }

    /**
     * FunctionName：lists
     * Description：列表
     * Author：lwl
     * @param $filter
     * @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection
     */
    public function lists($filter)
    {
        return $this->model::lists($filter);
    }

    /**
     * FunctionName：show
     * Description：
     * Author：lwl
     * @param int $id
     * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null
     */
    public function show(int $id)
    {
        return $this->model::show($id);
    }

    /**
     * FunctionName：edit
     * Description：
     * Author：lwl
     * @param array $params
     * @return int
     */
    public function edit($params)
    {
        return $this->model::edit($params);
    }

    /**
     * FunctionName：remove
     * Description：
     * Author：lwl
     * @param int $id
     * @return null
     */
    public function remove(int $id)
    {
        return $this->model::remove($id);
    }
}
